predict_path = './results/split_pos25.0_0_m2_True_1/sighan15/epoch-6/label_results.txt'
gold_path = '../data/realise/test.sighan15.lbl.tsv'
input_path = '../data/realise/test.sighan15.csv'

with open(predict_path, 'r') as f, open(gold_path, 'r') as g, open(input_path, 'r') as h:
    predict_lines = f.readlines()
    gold_lines = g.readlines()
    input_lines = h.readlines()[1:]
    error_case_count = 0
    # print(gold_lines[0])
    # print(input_lines[0])

    for line_id, (input, pred, gold) in enumerate(zip(input_lines, predict_lines, gold_lines)):
        id = gold.strip().split(', ')[0]
        input_sent = input.strip().split('\t')[1]
        gold_errors = gold.strip().split(', ')[1:]
        pred_errors = pred.strip().split(', ')[1:]

        if gold_errors == pred_errors:
            # print("equal")
            continue
        else:
            error_case_count += 1
            print("line_id: {}, input: {}\npred: {}, gold: {}".format(line_id+1, input_sent, pred_errors, gold_errors))

print("error case count: ", error_case_count)